package com.hzlx.controller;

import com.hzlx.MesFinishedGoodsInventoryDto;
import com.hzlx.feign2.FinishInventory;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import feign.Request;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping("/orders")
@Slf4j
public class Finish {
    @Resource
    FinishInventory finishInventory;
    @GetMapping("/inventory/goods/list")
    public TableDataInfo list(MesFinishedGoodsInventoryDto mesFinishedGoodsInventoryDto, HttpServletRequest request){
        mesFinishedGoodsInventoryDto.setOrderId("WO20250630003");

        log.info("接收到请求 - 方法: {}, 路径: {}", request.getMethod(), request.getRequestURI());

        // 调用 Feign 接口获取分页数据
        TableDataInfo tableData = finishInventory.list(mesFinishedGoodsInventoryDto);

        // 获取总记录数
        long total = tableData.getTotal();
        log.info("查询到的总记录数: {}", total);

        // 返回分页数据给前端
        return tableData;
    }
}
